<form method="post" action="/admin/dispatch/send" id="newDispatchForm">
   <input type="hidden" value="{%$templateData.id%}" name="id" />
   <div>
      <h4>{%$TR->meccano->users_groups%}:</h4><br />
      {%foreach from=$dGroups item='v'%}
      <input type="checkbox" name="f[group][]" value="{%$v.id%}" id="f_dispatch_{%$v.id%}"{%if $v.id eq 4%} checked="checked"{%/if%} />
      <label for="g_dispatch_{%$v.id%}">{%$v.group%}</label><br />
      {%/foreach%}

      <br />
      <table>
         <tr>
            <td><label for="f_subject">{%$TR->meccano->subject%}:</label></td>
            <td><input type="text" value="{%$templateData.title%}" name="f[subject]" id="f_subject" style="width: 300px;" /></td>
         </tr>
         <tr>
            <td><label for="f_start">{%$TR->subscribe->start_at%}:</label></td>
            <td><input type="text" value="{%$smarty.now+600|date_format:'%d.%m.%Y %H:%M'%}" id="f_start" name="f[start]" class="date" /></td>
         </tr>
      </table>
   </div><br />

   <input type="button" value=" {%$TR->meccano->start_dispatch|escape:'html'%} " onclick="confirmDispatch();" /> &nbsp; 
   <input type="button" value=" Cancel " onclick="$tabs.tabs('remove', 1).tabs('select', 0);" />

   <div style="border: 1px solid #377A00; width: 850px;margin: 20px 0; padding: 10px 10px 10px 60px;" id="dispatchTemplateExample">
      {%$templateExample%}
   </div>
</form>

<script type="text/javascript">
   $("#dispatchTemplateExample a.i_delete").click(function(){
      $(this).parent().remove();
      return false;
   });
   
   function confirmDispatch()
   {
      $("<div>{%$TR->subscribe->confirm_start|escape:'javascript'%}</div>").dialog({
         modal: true,
         buttons: {
            "Ok": function(){$("#newDispatchForm").submit();},
            "Cancel": function(){$(this).dialog("destroy");}
         }
      });
   }
</script>